<html lang="en" xml:lang="en"><head>
<META http-equiv="Content-Type" content="text/html">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><META name="description" content="How to use proxies."><meta name="content-language" content="en"><link href="rsrc/htmlhelp.css" rel="stylesheet" type="text/css"><title>Web AppBuilder for ArcGIS | Help - 
Use proxy
</title>
                <script type="text/javascript" language="JavaScript">
                    var pathL  = self.location.pathname.split ("/");
                    var fname = pathL[pathL.length-1];
                    var i = fname.lastIndexOf (".htm");
                    if (i>=0) {
                    fname = fname.substring (0, i)
                    } else {
                    //??
                    }
                    if (self.location.hash) {
				    		      fname = fname + self.location.hash;
						        }
                    self.location.replace ("../index.html#//" + fname);
                </script>
                </head><!--Publication GUID: [GUID-E7D1C130-8F87-4109-8D61-E73A46083F52]--><!--Topic GUID: [GUID-68D8F329-A82A-4BF4-B677-3A221E429DBF]--><body><div id="content"><div class="header"><h1>
Use proxy
</h1><div id="breadcrumb"></div></div>
    <p id="GUID-0E65BE99-6A9F-4071-BF89-9E391C85B506">When you deploy an app, you may need to use a   proxy. Web AppBuilder supports using proxies in  the following situations:</p>
    <p id="GUID-9E2DD2FA-15A7-42EC-90C4-2568BFEEF13F">
      <ul purpose="ul" id="UL_AAD5E759E5024D7EBA2A42A5FAD80CC5">
        <li purpose="li" id="LI_5DA2FA0CB7FF464B878C07CADE6B476B">Accessing cross domain resources</li>
        <li purpose="li" id="LI_7BAA76CEEA294AC09878AE50CC048FF7">Requests that exceed 2048 characters</li>
        <li purpose="li" id="LI_8D11EEE475D24D2584A2881EB8313A2F">Accessing resources secured with token based authentication</li>
        <li purpose="li" id="LI_1ADD1071B25346F986254224A590B9A2">
          <a target="_blank" class="xref" href="https://developers.arcgis.com/authentication" rel="https://developers.arcgis.com/authentication">OAuth 2.0 app logins</a></li>
        <li purpose="li" id="LI_DBBF6F132C204668B2D32D66CD11B89C">Enabling logging</li>
        <li purpose="li" id="LI_0345F88A06B444338A9E58E796BDBCF9">Both resource- and referer-based rate limiting</li>
      </ul>
    </p>
    <p id="GUID-7243949E-1589-431E-9C2A-E0B1B7E324DF">
      <span purpose="ph" ishcondition="agol_plat=wab_dev">By default, the downloaded app's proxy setting is blank. </span>Specify your own proxy and rules by modifying the <span class="uicontrol">httpProxy</span> property in the app's config file. The <span class="uicontrol">httpProxy</span> property contains the following attributes:</p>
    <div class="block_table" id="TABLE_7C602943C13B42CFA807FC3984B09207" purpose="block_table"><span class="table_title"></span><table class="table"><colgroup width="*"></colgroup><colgroup width="*"></colgroup><tr purpose="thead"><th class="th" purpose="th" rowspan="1" colspan="1"><p id="GUID-95417B2A-2CAA-4DD8-B9D1-F5CDDECB10AB">Attribute</p>
            </th><th class="th" purpose="th" rowspan="1" colspan="1"><p id="GUID-E8C8A7BD-2D11-416C-BC7E-3256D5475777">Description</p>
            </th></tr><tbody>
          
          <tr>
            <td purpose="entry" rowspan="1" colspan="1">
              <p id="GUID-E9907BA0-EFA3-4C5F-8D1C-15142976407E">useProxy</p>
            </td>
            <td purpose="entry" rowspan="1" colspan="1">
              <p id="GUID-8B5A4683-0011-46B3-995C-D97D8094309D">Boolean. Optional. Default: true. If false, all requests will not use a proxy.</p>
            </td>
          </tr>
          <tr>
            <td purpose="entry" rowspan="1" colspan="1">
              <p id="GUID-CFD523AF-8D8D-4875-AE92-50C745C104C2">url</p>
            </td>
            <td purpose="entry" rowspan="1" colspan="1">
              <p id="GUID-10C38A92-D8CF-48C7-BB96-DE286E078FA9">String. Optional. The URL to specify the proxy location. If the request doesn't match any proxy rule but must use a proxy, such as a cross domain request, this proxy will be used. </p>
            </td>
          </tr>
          <tr>
            <td purpose="entry" rowspan="1" colspan="1">
              <p id="GUID-078C0DCE-FC01-4771-BDDC-4F59970BB559">alwaysUseProxy</p>
            </td>
            <td purpose="entry" rowspan="1" colspan="1">
              <p id="GUID-770CFC53-A676-4564-B166-357446E4383B">Boolean. Optional. Specifies whether or not the proxy should always be used for communication to a REST endpoint. Default: false. If the request doesn't match any proxy rule and doesn't need a proxy, the app checks this property to determine how to further use the proxy.  If false, the request does not go through the <span class="usertext">url</span> referenced  proxy. If true, the request goes through the <span class="usertext">url</span> referenced proxy. </p>
            </td>
          </tr>
          <tr>
            <td purpose="entry" rowspan="1" colspan="1">
              <p id="GUID-3EEF5BFE-68BA-4941-A4D1-0DA3FAF0C706">rules</p>
            </td>
            <td purpose="entry" rowspan="1" colspan="1">
              <p id="GUID-CCF3F0AE-EB55-4D88-A7DF-C57BB7F6BF5B">Object[]. Optional. Defines the proxy for a set of resources with the same URL prefix.  If the request URL matches a rule, the request routes through the proxy. Each rule has two properties:<ul purpose="ul" id="UL_9F35EF18D7C34548903A27BD63E2134D"><li purpose="li" id="LI_AFFF5E0767B64375B42ED1105CF524D4">urlPrefix-string—URL prefix for resources that need to be accessed through the given proxy. </li><li purpose="li" id="LI_65BDD7E160854FF7B40EFDDE8C6F29FD">proxyUrl-string—URL for the proxy.</li></ul></p>
            </td>
          </tr>
        </tbody></table><span class="table_desc"></span></div>
    <div class="notes" id="GUID-C6F07DBB-DA88-47DC-A821-086CF0DD08E2"><div class="caution"><img class="note_img" src="rsrc/caution.png" alt="Caution" title="Caution"><span>Caution:</span></div><div class="tipbody"><p id="GUID-B89CFF24-9333-4CE4-80F2-D23ED4FF2993">When <span class="usertext">useProxy</span>  is  false and a request is larger than 2048 characters, a POST instead of GET request  is sent. Also, if the service supports CORS, the POST  request can be sent directly to the service successfully. Otherwise, the POST request fails.  When  <span class="usertext">useProxy</span> is  true and a POST request  is sent, if the service doesn't support CORS, the POST request will be sent by the proxy automatically.</p></div></div><p id="GUID-76AD9D64-4667-4574-8E47-4C1E248E3C83">The following demonstrates how proxies work in relation to the above attributes: </p>
    <ul purpose="ul" id="UL_7DE06E2856B44C62BCED92B907075769">
      <li purpose="li" id="LI_AF842FDEFB2D4E578FEF9CD5B0025CD8">The app checks <span class="usertext">useProxy</span>.<ul purpose="ul" id="UL_2CD2B0E4E34A460C904774C284DBFC71"><li purpose="li" id="LI_2C3223D7BBF94396A8781FCB229F9CC6">If false, all requests do not use a proxy.</li><li purpose="li" id="LI_49181CEF43654967BB7A8D0D78349A73">If  true, the app checks <span class="usertext">rules</span>.<ul purpose="ul" id="UL_DB37997C38314DC0897D2AC7D8E8E9EF"><li purpose="li" id="LI_8E95B1F6CD474A6C80DF89681F98F253"> If the request matches the proxy rules, the app uses the <span class="usertext">proxyUrl</span> set in the rules.</li><li purpose="li" id="LI_1AD2207BEDAE4857990BBA2CD900A391"> If the request does not match any proxy rule but has to use a proxy, such as a cross domain request, the app uses the <span class="usertext">url</span> referenced  proxy.</li><li purpose="li" id="LI_B6A76CE2AA974871B90143FA60E73091">If the request does not match the proxy rules nor requires a proxy, the app checks <span class="usertext">alwaysUseProxy</span> further.<ul purpose="ul" id="UL_A4B98692594B4291BCD1B6F3C20B7B26"><li purpose="li" id="LI_F5608734F72848888FCA821E2F5DB4F0">If false, the request does not go through the <span class="usertext">url</span> referenced  proxy.</li><li purpose="li" id="LI_8E840B34B2CE4FEBB9684D469878E713">If true, the request goes through the  <span class="usertext">url</span> referenced  proxy.</li></ul></li></ul></li></ul></li>
    </ul>
    <div class="image" purpose="image"><table><tr><td><img class="break" src="03w3/GUID-35ABC6CF-A1C6-429C-9A4D-C7F54F508FBD-web.png" purpose="img" alt="Proxy diagram" title="Proxy diagram"></td></tr></table></div>
    <p id="GUID-B79E79A1-46D5-4D8F-9B86-7884AC3037EE">Example:</p>
    <p id="GUID-89F64932-DA9F-44D6-A8C6-05EA084E2F7D">
      <div class="codeblock" purpose="codeblock">
        <div class="codeblockdesc" purpose="codeblockdesc">
          
        </div>
        <div class="highlight"><pre><code>&quot;httpProxy&quot;: {
		&quot;useProxy&quot;: true,
		&quot;url&quot;: &quot;http://gallery.chn.esri.com/arcgis/sharing/proxy&quot;,
		&quot;alwaysUseProxy&quot;: false,
		&quot;rules&quot;: [{
			&quot;urlPrefix&quot;: &quot;http://route.arcgis.com/&quot;,
			&quot;proxyUrl&quot;: &quot;resource-proxy-1.0/DotNet/proxy.ashx&quot;
		}]
	}
</code></pre></div>

      </div>
    </p>
    <p id="GUID-B75906D1-E096-4D69-857E-BD150FFA32F3">In addition, Esri provides three proxies, each targeting a specific server-side platform: ASP.NET, Java/JSP, and PHP. Download and deploy the
appropriate proxy for your platform from <a target="_blank" class="xref" href="https://github.com/esri/resource-proxy/" rel="https://github.com/esri/resource-proxy/">GitHub</a>. Also, see the <a target="_blank" class="xref" href="https://developers.arcgis.com/javascript/jshelp/ags_proxy.html" rel="https://developers.arcgis.com/javascript/jshelp/ags_proxy.html">Using the proxy</a> and <a target="_blank" class="xref" rel="http://blogs.esri.com/esri/supportcenter/2015/10/28/setting-up-a-proxy-with-web-appbuilder-for-arcgis-developer-edition/" href="http://blogs.esri.com/esri/supportcenter/2015/10/28/setting-up-a-proxy-with-web-appbuilder-for-arcgis-developer-edition/">Setting up a proxy with Web AppBuilder</a> examples from the blog post.</p>
  <div class="footer"> Copyright © 1995-2016 Esri. All rights reserved. </div></div></body></html>